﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using WebExam.Core.Repository;

namespace WebExam.DataEntities
{
    [Table(Name = "dbo.ZG")]
    public partial class ZG : Entity
    {

        private decimal _zgId;

        private string _zgName;

        private bool _zgSex;

        private string _zgPwd;

        private bool _bMana;

        private bool _bWork;

        private EntitySet<BJ> _BJ;

        public ZG()
        {
            this._BJ = new EntitySet<BJ>(new Action<BJ>(this.attach_BJ), new Action<BJ>(this.detach_BJ));
        }

        [Column(Storage = "_zgId", AutoSync = AutoSync.OnInsert, DbType = "Decimal(18,0) NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public decimal ZGId
        {
            get
            {
                return this._zgId;
            }
            set
            {
                if ((this._zgId != value))
                {
                    this.SendPropertyChanging("ZGId");
                    this._zgId = value;
                    this.SendPropertyChanged("ZGId",value);
                }
            }
        }

        [Column(Storage = "_zgName", DbType = "VarChar(20) NOT NULL", CanBeNull = false)]
        public string ZGName
        {
            get
            {
                return this._zgName;
            }
            set
            {
                if ((this._zgName != value))
                {
                    this.SendPropertyChanging("ZGName");
                    this._zgName = value;
                    this.SendPropertyChanged("ZGName",value);
                }
            }
        }

        [Column(Storage = "_zgSex", DbType = "Bit")]
        public bool ZGSex
        {
            get
            {
                return this._zgSex;
            }
            set
            {
                if ((this._zgSex != value))
                {
                    this.SendPropertyChanging("ZGSex");
                    this._zgSex = value;
                    this.SendPropertyChanged("ZGSex",value);
                }
            }
        }

        [Column(Storage = "_zgPwd", DbType = "VarChar(16) NOT NULL", CanBeNull = false)]
        public string ZGPwd
        {
            get
            {
                return this._zgPwd;
            }
            set
            {
                if ((this._zgPwd != value))
                {
                    this.SendPropertyChanging("ZGPwd");
                    this._zgPwd = value;
                    this.SendPropertyChanged("ZGPwd",value);
                }
            }
        }

        [Column(Storage = "_bMana", DbType = "Bit")]
        public bool BMana
        {
            get
            {
                return this._bMana;
            }
            set
            {
                if ((this._bMana != value))
                {
                    this.SendPropertyChanging("BMana");
                    this._bMana = value;
                    this.SendPropertyChanged("BMana",value);
                }
            }
        }

        [Column(Storage = "_bWork", DbType = "Bit")]
        public bool BWork
        {
            get
            {
                return this._bWork;
            }
            set
            {
                if ((this._bWork != value))
                {
                    this.SendPropertyChanging("BWork");
                    this._bWork = value;
                    this.SendPropertyChanged("BWork",value);
                }
            }
        }

        [Association(Name = "ZG_BJ", Storage = "_BJ", ThisKey = "ZGId", OtherKey = "ZGId")]
        public EntitySet<BJ> BJ
        {
            get
            {
                return this._BJ;
            }
            set
            {
                this._BJ.Assign(value);
            }
        }

        private void attach_BJ(BJ entity)
        {
            entity.ZG = this;
        }

        private void detach_BJ(BJ entity)
        {
            entity.ZG = null;
        }
    }
}
